<?php
/**
 * 业主信息
 *
 */
class OwnerInfoAction extends BaseAction{
    public function index(){
		$model = D('OwnerInfo');
		$data_list = $model->order('community_no desc')->select();
		$this->assign('data_list',$data_list);
		$this->display();
    }
	public function add(){
		$this->display();
	}
	
	/**
	 * 新增
	 */
	public function save(){
		$model = D('OwnerInfo');
		if($model->create()) {
			$result =   $model->add();
			if($result) {
				$this->success('操作成功！');
			}else{
				$this->error('写入错误！');
			}
		}else{
			$this->error($model->getError());
		}
	}
	
	public function delete($id=0) {
		$model = M ( 'OwnerInfo' );
		$result = $model->delete ( $id );
		if ($result) {
			$this->success ( '删除成功！' );
		} else {
			$this->error ( '删除错误！' );
		}
	}
	
	public function edit($id=0){
		$model = M('OwnerInfo');
		$this->vo = $model->find($id);
		$this->display();
	}
	
	/**
	 * 修改
	 */
	public function update(){
		$model   =   D('OwnerInfo');
		if($model->create()) {
			$result =   $model->save();
			if($result) {
				$this->success('操作成功！');
			}else{
				$this->error('写入错误！');
			}
		}else{
			$this->error($Form->getError());
		}
	}

}